package com.jefe;

import java.io.Serializable;
/**
 *
 * @author Sonali Mendis
 * Hudson Portlet for Jefe (http://www.jefesolutions.com)
 * GNU License
 */
public class HudsonProject implements Serializable{
    private String projectName;
    private String projectURL;
    private String lastBuildImage;
    private String lastBuildStatus;

    public HudsonProject() {
    }

    public String getLastBuildImage() {
        return lastBuildImage;
    }

    public void setLastBuildImage(String lastBuildImage) {
        this.lastBuildImage = lastBuildImage;
    }

    public String getLastBuildStatus() {
        return lastBuildStatus;
    }

    public void setLastBuildStatus(String lastBuildStatus) {
        this.lastBuildStatus = lastBuildStatus;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getProjectURL() {
        return projectURL;
    }

    public void setProjectURL(String projectURL) {
        this.projectURL = projectURL;
    }

    public void setBuildStatusFromColor(String color){
        if(color.equals("red")){
            setLastBuildImage("red.gif");
            setLastBuildStatus("FAILED");
        }else if(color.equals("yellow")){
            setLastBuildImage("yellow.gif");
            setLastBuildStatus("UNSTABLE");
        }else if(color.equals("blue")){
            setLastBuildImage("blue.gif");
            setLastBuildStatus("SUCCESS");
        }else{
            setLastBuildImage("grey.gif");
            setLastBuildStatus("UNKNOWN");
        }
    }
}
